#include "CounterThread.h"
#include "CameraCounter.h"


CounterThread::CounterThread(CameraCounter& counter, int duration):
    m_counter(counter),
    m_duration(duration),
	m_canExit(false)
{

}

void CounterThread::run()
{
    while (!m_canExit)
    {
        m_counter.processCount();

		emit counterDone();

        m_event.timedwait(m_duration);
    }
}

void CounterThread::stop()
{
    m_canExit = true;
    m_event.post();
}
